<!DOCTYPE HTML>
<html style="min-width:inherit;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
<link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
<script src="/static/public/layer/src/layui.js"></script>


</head>

<body>


<form class="layui-form" >

  <div class="layui-form-item" style="padding-top:15px;padding-right:30px;">
    <label class="layui-form-label">本课主题</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="本课主题" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">

      <label class="layui-form-label">上课时间</label>
      <div class="layui-input-inline">
        <input type="text" name="class_time" lay-verify="required" placeholder="yyyy-mm-dd HH:mm" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm'})">
      </div>

  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
    <label class="layui-form-label">类型</label>
    <div class="layui-input-inline">
      <input type="radio" name="class_type" value="0" title="正常" checked="">
      <input type="radio" name="class_type" value="1" title="补课">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">本次课时</label>
    <div class="layui-input-inline">
       <input type="number" name="class_hour" lay-verify="number" autocomplete="off" class="layui-input" placeholder="课时：分钟">

    </div>
  </div>


  <div class="layui-form-item">
    <label class="layui-form-label">讲师</label>
    <div class="layui-input-inline">
      <select name="teacher_id" lay-verify="required">
        <option value=""></option>
        <{foreach from=$teachers item=item}>
        <option value="<{$item['id']}>" <{if $class_info['lecturer_id']==$item['id'] }>selected<{/if}> ><{$item['teacher_name']}></option>
        <{/foreach}>
      </select>
    </div>


  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">教室</label>
    <div class="layui-input-inline">
      <select name="class_room" lay-verify="required">
        <option value=""></option>
        <{foreach from=$room_list item=item}>
        <option value="<{$item['id']}>" <{if $class_info['classroom']==$item['id'] }>selected<{/if}>><{$item['name']}></option>
        <{/foreach}>
      </select>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">备注信息</label>
    <div class="layui-input-block">
      <textarea name="remark" style="width:460px;" placeholder="备注内容" class="layui-textarea"><{if isset($student)}><{$student['remark']}><{/if}></textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>

    </div>
  </div>
</form>


<{include file="footer.html"}>
<script>
layui.use(['form', 'laydate'], function(){
  var form = layui.form()
  ,layer = layui.layer
  ,laydate = layui.laydate;



  //监听提交
  form.on('submit(demo1)', function(data){
    var title = $("input[name='title']").val();
    var class_time = $("input[name='class_time']").val();
    var class_hour = $("input[name='class_hour']").val();

    var class_type = $('input[name="class_type"]:checked ').val();
    var teacher_id = $("select[name='teacher_id']").val();
    var class_room = $("select[name='class_room']").val();
    var remark = $("textarea[name='remark']").val();

    $.post('/class_plan/add_single/<{$class_id}>',{'title':title,'class_time':class_time,'class_hour':class_hour,'class_type':class_type,'teacher_id':teacher_id,'class_room':class_room,'remark':remark},function(res){
        var obj = eval('(' + res + ')');
        if(obj.result==0){
          window.parent.save_close();
        }else {
          alert(obj.msg);
        }
    });

    return false;
  });


});
</script>



</body>
</html>
